<!DOCTYPE html>

<html lang="en">



<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>动态渐变背景登录页</title>

    <style>

        body {

            background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);

            background-size: 400% 400%;

            animation: gradient 15s ease infinite;

            height: 100vh;

            display: flex;

            justify-content: center;

            align-items: center;

            font-family: Arial, sans-serif;

        }



        @keyframes gradient {

            0% {

                background-position: 0% 50%;

            }



            50% {

                background-position: 100% 50%;

            }



            100% {

                background-position: 0% 50%;

            }

        }



        .login-container {

            background-color: rgba(255, 255, 255, 0.8);

            padding: 20px;

            border-radius: 10px;

            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);

            width: 300px;

        }



        .login-container h2 {

            text-align: center;

            margin-bottom: 20px;

        }



        .login-container input {

            width: calc(100% - 22px); /* 修改输入框宽度，减去内边距和边框宽度 */

            padding: 10px;

            margin-bottom: 15px;

            border: 1px solid #ccc;

            border-radius: 5px;

            box-sizing: border-box; /* 使内边距和边框包含在宽度内 */

        }



        .login-container button {

            width: 100%;

            padding: 10px;

            background-color: #007BFF;

            color: white;

            border: none;

            border-radius: 5px;

            cursor: pointer;

        }



        .login-container button:hover {

            background-color: #0056b3;

        }



        .error-message {

            color: red;

            text-align: center;

            margin-top: 10px;

        }

    </style>

</head>



<body>

    <div class="login-container">

        <h2>登录</h2>

        <input type="text" id="username" placeholder="用户名">

        <input type="password" id="password" placeholder="密码">

        <button onclick="login()">登录</button>

        <div id="error" class="error-message"></div>

    </div>

    <script>

        function login() {

            const username = document.getElementById('username').value;

            const password = document.getElementById('password').value;



            if (username === 'aaa' && password === 'bbb') {

                window.location.href = '1.html';

            } else {

                document.getElementById('error').innerHTML = '密码错误';

            }

        }

    </script>

</body>



</html>